package BC95_最高分与最低分之差;

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        while (sc.hasNext()){
            list.add(sc.nextInt());
        }

        list.sort(Integer::compareTo);
        System.out.println(list.get(list.size() - 1) - list.get(0));
    }
}
